build: automate release packaging and version bumps with changesets#592
build: automate release packaging and version bumps with changesets#592
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
=======================================
Coverage 99.86% 99.86%
=======================================
Files 7 7
Lines 718 718
=======================================
Hits 717 717
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…g notes Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
🚢 Wanting to share now a previewed artifacts of investigation with some logs and comments following:
🔗 https://github.com/zimeg/slack-github-action/releases/tag/v3.0.7
📸 Preview
A few secrets will be added alongside these changes with follow up for release announcements to test the release process 👾 ✨
| ## Docs | ||
|
|
||
| This repo contains two types of docs files: | ||
|
|
||
| - markdown files | ||
| - sidebar.json | ||
|
|
||
| The private repo containing the docs.slack.dev site pulls these in at build time. | ||
|
|
||
| Maintainers need to use the `run workflow` button associated with the `deploy` workflow in that private repo to update the docs with changes from here. | ||
|
|
||
| ### Markdown Files | ||
|
|
||
| The markdown files here are secretly mdx files in disguise. | ||
|
|
||
| If you'd like to add images to pages, add the image files to the same folder the md file is in. | ||
|
|
||
| We appreciate markdown edits from anyone!!! | ||
|
|
||
| ### Sidebar | ||
|
|
||
| `_sidebar.json` sets the slack github action docs sidebar | ||
|
|
||
| sidebar values take the form of "slack-github-action/path-within-docs/" | ||
|
|
||
| or, in other words - full path but remove "docs": | ||
| path: slack-github-action/docs/sending-variables.md | ||
| value: slack-github-action/sending-variables | ||
|
|
||
| for info on syntax see https://docusaurus.io/docs/sidebar | ||
|
|
||
| this file is copied into slackapi.github.io/slack-github-action/sidebar.js it is then called in slackapi.github.io/sidebars.js | ||
|
|
There was a problem hiding this comment.
📚 note: This section is moved before releases to match adjacent guides!
| { | ||
| "name": "slack-github-action", | ||
| "version": "3.0.1", | ||
| "private": true, |
There was a problem hiding this comment.
💡 note: This project isn't published to npm so we mark it as private.
| "files": [ | ||
| "action.yml", | ||
| "cli/", | ||
| "dist/" | ||
| ], |
There was a problem hiding this comment.
📫 note: This isn't required but hopes to signal separate production files from development. We considered using it to package the release but found that made the workflow more complex.
| "lint:fix": "biome check --write", | ||
| "test": "node --test --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=test/coverage.txt test/*.spec.js", | ||
| "postversion": "TAG=\"v$(npm pkg get version | jq -r)\" && grep -rl 'slackapi/slack-github-action@v' ./docs ./example-workflows | xargs sed -i \"s|slackapi/slack-github-action@v.*|slackapi/slack-github-action@${TAG}|g\" && grep -rl 'slackapi/slack-github-action/cli@v' ./docs ./example-workflows | xargs sed -i \"s|slackapi/slack-github-action/cli@v.*|slackapi/slack-github-action/cli@${TAG}|g\"" | ||
| "version": "npm run changeset version && npm install && npm run docs" |
There was a problem hiding this comment.
🪬 note: This script is mentioned as version with particular care made to callsites that use:
$ npm run versionWhich is this command and different from the included version script but this remains most clear here and adjacent callsite I think.
|
|
||
| - name: Distribute the latest tagged release | ||
| id: tag | ||
| uses: teunmooij/github-versioned-release@3edf649c6e5e5e976d43f2584b15bdc8b4c8f0df # v1.2.1 |
There was a problem hiding this comment.
🌟 praise: Thank you for sharing this elegant approach to packaging @teunmooij!
There was a problem hiding this comment.
📣 note: This arrived in #588 that we can include in the next release!
| - name: Update release PR | ||
| id: changesets | ||
| uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0 | ||
| with: | ||
| commit: "chore: release" | ||
| title: "chore: release" | ||
| version: npm run version | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
👁️🗨️ note: Here's an example preview! zimeg#11
| - name: Gather version | ||
| id: version | ||
| run: | | ||
| VERSION="v$(node -p 'require("./package.json").version')" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "major=$(echo "$VERSION" | cut -d. -f1)" >> "$GITHUB_OUTPUT" | ||
| echo "minor=$(echo "$VERSION" | cut -d. -f1-2)" >> "$GITHUB_OUTPUT" | ||
| echo "$VERSION" |
There was a problem hiding this comment.
🐢 note: The major and minor versions are both used as floating tags and aren't considered immutable. That's just for tags that have a proper release:
If you want to be able to update the Git tag of a release later, do not create a release on GitHub. Instead, create a tag as follows...
Summary
This PR automates release packaging and version bump with changesets to bring immutable releases to this project. Closes #521 🔏
Requirements